package com.yiwenup.leetcode.hot;

import com.yiwenup.leetcode.TreeNode;

/**
 * @PROJECT struct-algorithm
 * @PACKAGE com.yiwenup.leetcode.hot
 * @Author yiwenup
 * @Date 2022-02-19 18:32:55
 * <p>
 * @DESCRIPTION https://leetcode-cn.com/problems/invert-binary-tree/
 */
public class No0226 {
    public TreeNode invertTree(TreeNode root) {
        if (root == null) return root;
        TreeNode tmp = root.left;
        root.left = root.right;
        root.right = tmp;

        invertTree(root.left);
        invertTree(root.right);

        return root;
    }
}
